import config from "@/config"
import http from "@/utils/request"

export default {

  // 我的抄送
  getMySendList: {
    url: `${config.API_URL}/toSend/pageList`,
    name: "获取我的抄送列表",
    get: function (param) {
      return new Promise((resolve, reject) => {
        http.get(this.url, param).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  // 我的审批
  getMyExamineList: {
    url: `${config.API_URL}/examine/auditPageList`,
    name: "获取我的审批列表",
    get: function (param) {
      return new Promise((resolve, reject) => {
        http.get(this.url, param).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  // 我的申请
  getMyApplyList: {
    url: `${config.API_URL}/examine/applicantPageList`,
    name: "获取我的申请列表",
    get: function (param) {
      return new Promise((resolve, reject) => {
        http.get(this.url, param).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  // 我的消息
  myNews: {
    getMyNewsList: {
      url: `${config.API_URL}/doReminder/list`,
      name: "获取我的消息列表",
      get: function (param) {
        return new Promise((resolve, reject) => {
          http.get(this.url, param).then((response) => {
            resolve(response)
          }).catch((error) => {
            resolve(error.data)
          })
        })
      }
    },
    changeNewsStatus: {
      url: `${config.API_URL}/doReminder/changeStatus`,
      name: "将消息标记为已读",
      post: function (data) {
        return new Promise((resolve, reject) => {
          http.postParam(this.url, data).then((response) => {
            resolve(response)
          }).catch((error) => {
            resolve(error.data)
          })
        })
      }
    },
    getWaitNews: {
      url: `${config.API_URL}/doReminder/list`,
      name: "获取待办消息提醒列表",
      get: function (data) {
        return new Promise((resolve, reject) => {
          http.get(this.url, data).then((response) => {
            resolve(response)
          }).catch((error) => {
            resolve(error.data)
          })
        })
      }
    },
  }

}
